Hive 分析函数

array_contains 判断array是否含有某个元素

select
    task_id,
    task_code,
    task_version,
    case
        when array_contains(collect_set(tag_id), 599)
            or array_contains(collect_set(tag_id), 1225)
        then 'L1-级别'
        when array_contains(collect_set(tag_id), 600)
            or array_contains(collect_set(tag_id), 1226)
        then 'L2-级别'
        when array_contains(collect_set(tag_id), 601)
            or array_contains(collect_set(tag_id), 1240)
        then 'L3-级别'
        when array_contains(collect_set(tag_id), 1166)
            or array_contains(collect_set(tag_id), 1241)
        then '鹰眼监控汇总'
        else '非鹰眼监控任务'
    end as core_tag_name
from
    fdm.fdm_buffalo_uniontask_tag_theme_info_new
where
    dt = sysdate( - 1)
group by
    task_id,
    task_code,
    task_version

results matching ""

    No results matching ""